<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>漫画内容信息管理--漫画内容信息修改</title>
    <link rel="stylesheet" href="/back/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/back/css/bootstrap.min.css">
</head>
<body>
<style>
    img{
        width: 200px;
        height: 100px;
    }
</style>
<div class="container">
    <div class="page-header">修改漫画内容信息</div>
    <?php
    // 1. 判断是否有proId,section参数
    if(empty($_GET["proId"])){
        die("缺少proId参数！");
    }
    if(empty($_GET["section"])){
        die("缺少section参数！");
    }
    //  如果有参数，生一个 select * from content where section = 传入的section and proId = 传入的proId，查询语句
    $proId = $_GET["proId"];
    $section = $_GET["section"];
    $sql = "select * from content where proId= $proId and section=$section";
    // 进行数据库操作，执行sql语句，并查询出 一条资讯信息
    include_once dirname(__FILE__) .'../../common/conn.php';
    $res = mysqli_query($con,$sql);
    mysqli_close($con);
    if(!$res){
        die("查询错误！");
    }
    //判断是否有查到资讯信息
    $row = mysqli_fetch_array($res,1);
    if(!$row){
        die("没有查到此漫画内容信息，<a href='contentList.php'>请重新选择</a>");
    }
    // 将查出的资讯信息填充到下面的表单中
    ?>
    <!--设计一个表单，让管理员填写信息，并提交到服务器-->
    <form action="editSave.php" method="post" class="form-horizontal" enctype="multipart/form-data">

        <input type="hidden" name="pro_id" value="<?php echo $row['proId'] ?>" />
        <input type="hidden" name="csection" value="<?php echo $row['section'] ?>" />


        <!--作品ID-->
        <div class="form-group">
            <label for="pro_id" class="col-sm-2 control-label">作品id</label>
            <div class="col-sm-10">
                <input type="text" class="form-control"  name="pro_id" value="<?php echo $row['proId']  ?>" readonly="true"  />
            </div>
        </div>

        <!--章节序号-->
        <div class="form-group">
            <label for="csection" class="col-sm-2 control-label">章节序号</label>
            <div class="col-sm-10">
                <input type="text" class="form-control"  name="csection" value="<?php echo $row['section']  ?>" readonly="true"  />
            </div>
        </div>
        <!--章节封面图片-->
        <div class="form-group">
            <label for="section_Img" class="col-sm-2 control-label">章节封面图</label>
            <div class="col-sm-10">
                <img class="img-thumbnail small" src="<?php  echo $row["sectionImg"]  ?>"/>
                <input type="file" class="form-control" name="section_Img">
            </div>
        </div>
        <!--章节名称-->
        <div class="form-group">
            <label for="section_Name" class="col-sm-2 control-label">章节名称</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" name="section_Name" id="section_Name" value="<?php echo $row['sectionName']?>" placeholder="请输入章节名称">
            </div>
        </div>
        <!--章节内容图片-->
        <div class="form-group">
            <label for="img_Url" class="col-sm-2 control-label">章节内容图</label>
            <div class="col-sm-10">
                <img class="img-thumbnail small" src="<?php  echo $row["imgUrl"]  ?>"/>
                <input type="file" class="img_Url" name="img_Url">
            </div>
        </div>


        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-info">保存</button>
                <a href="cList.php" class="btn btn-warning">返回</a>
            </div>
        </div>
    </form>
</div>
</body>
</html>